package com.xuhai.blog19.admin.controller;

import com.xuhai.blog19.admin.entity.WebsiteEntity;
import com.xuhai.blog19.admin.service.WebsiteService;
import com.xuhai.blog19.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author PangJunjie
 * @Date 2023/2/8/008
 */
@RestController
@RequestMapping("/admin/website")
public class WebsiteController {
    @Autowired
    private WebsiteService websiteService;

    @GetMapping("/info")
    public R info() {
        return R.ok().data(websiteService.getById(1));
    }

    @PostMapping("/update")
    public R update(@RequestBody WebsiteEntity website) {
        websiteService.saveOrUpdate(website);
        return R.ok();
    }
}
